{$cleo .cs}

0000:

const
    ped_handle        = 11@
    ped_weapons       = 12@
    ped_weapons_model = 13@
    tm_addres         = 14@
    object_handle     = 15@
    rand_x            = 16@
    rand_y            = 17@
    TO_MODEL          = 18@
    TO_WEAPON         = 19@
END

//hook
0ab4: ped_handle < 543 
0AC6: tm_addres = label @actor_handle offset
0A8C: write_memory tm_addres size 4 value ped_handle virtual_protect 0 //OF 


while true
    wait 0
    0AC6: tm_addres = label @actor_handle offset                                                                        
    0A8d: ped_handle tm_addres  4  0                                            
    if 056D:   actor ped_handle defined                                         
    then 
        goto @create_pickup
          
    else end_thread                                                             
    end                                                                         
end


:create_pickup 
0208: rand_x = random_float_in_ranges -0.5 0.5 
0208: rand_y = random_float_in_ranges -0.5 0.5 
04C4: store_coords_to 3@ 4@ 5@ from_actor ped_handle with_offset rand_x rand_y -1.2
0819: 6@ = actor ped_handle distance_from_ground
0a5b: 5@ += 6@
5@ += 0.1  
object_handle = Object.Create(#ARMOUR, 3@, 4@, 5@)
Object.CollisionDetection(object_handle) = False
08D2: object object_handle scale_model 1.5

02CE: 7@ = ground_z_at 3@ 4@ 5@
7@ += 0.2
OBJECT.PutAt(object_handle, 3@, 4@, 7@)

33@ = 0
while true
    wait 0 
    0400: store_coords_to 8@ 9@ 10@ from_object object_handle with_offset 0.0 0.0 0.1
    016F: create_particle 3 rotation_factor 0.0 size 0.5 intensity 150 flags 252 64 0 at 8@ 9@ 10@
    if 33@ >= 30000
    then goto @clean
    else 
        if 0475:   actor $PLAYER_ACTOR near_object_in_cube object_handle radius 1.5 1.5 1.5 sphere 0 on_foot 
        then goto @give
        end
    end
end


:clean 
Object.Destroy(object_handle)
end_thread

:give
Actor.AddArmour($PLAYER_ACTOR, 150)
Object.Destroy(object_handle)
end_thread

:actor_handle
hex
00 00 00 00
end

:object_handle
hex
00 00 00 00
end























         

